package com.py.credit.entity.enums;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import com.py.credit.entity.common.OptionalColumn;

/**
 * 批次表
 * 
 * @author jcm
 *
 */
public enum ResourceBatchLogFieldsEnum {

	BATCH_ID("batchId", "批次号", "varchar", "input", true, false, new HashMap<String, String>(), true, true), TABLENAME(
			"tableName", "数据目录", "varchar", "input", true, true, new HashMap<String, String>(), true,
			true), DEPTNAME("deptName", "采集部门", "varchar", "input", true, false, new HashMap<String, String>(), false,
					false), AREANAME("areaName", "采集区域", "varchar", "input", true, false, new HashMap<String, String>(),
							false, false), TYPE("type", "采集类型", "varchar", "select", true, false,
									new HashMap<String, String>() {
										private static final long serialVersionUID = 1L;
										{
											put("0", "文件导入");
											put("1", "接口录入");
											put("2", "手工录入");
											put("3", "ETL采集");
											put("4", "反馈");
										}
									}, true, true),
	// DATASOURCENAME("datasourceName", "数据源名称", "varchar", "input", false,
	// false,new HashMap<String, String>(), false, false),
	/*
	 * STATUS("status", "当前状态", "varchar", "select", false, false, new
	 * HashMap<String, String>() { private static final long serialVersionUID =
	 * 1L; { put("0", "未处理"); put("1", "处理中"); put("2", "已完成");
	 * 
	 * } }, true, true),
	 */
	RESULT("result", "采集状态", "varchar", "select", true, false, new HashMap<String, String>() {
		private static final long serialVersionUID = 1L;
		{
			put("S", "成功");
			put("F", "失败");
			put("P", "部分成功");
			put("C", "已撤销");
			put("R", "进行中");
		}
	}, true, true),

	TCOUNT("tcount", "采集总条数", "integer", "input", true, false, new HashMap<String, String>(), false, false), SCOUNT(
			"scount", "成功数", "integer", "", true, false, new HashMap<String, String>(), false, false), FCOUNT("fcount",
					"失败数", "integer", "input", true, false, new HashMap<String, String>(), false,
					false), RCOUNT("rcount", "重复数", "integer", "input", true, false, new HashMap<String, String>(),
							false, false), WAITCOUNT("waitCount", "待关联数", "integer", "input", false, false,
									new HashMap<String, String>(), false, false), MANAGERNAME("managerName", "采集人员",
											"varchar", "input", true, false, new HashMap<String, String>(), false,
											false), START_TIME("start_time", "采集开始时间", "date", "", true, false,
													new HashMap<String, String>(), true, false), END_TIME("end_time",
															"采集结束时间", "date", "", false, false,
															new HashMap<String, String>(), true, false);

	private String colNameEN;
	private String colNameCN;
	private String type;
	private boolean defaultShow;
	private String widget;
	private boolean fuzzy;
	private HashMap<String, String> widgetValue;
	private boolean advanceConditionShow;
	private boolean searchIsShow;

	private ResourceBatchLogFieldsEnum(String colNameEN, String colNameCN, String type, String widget,
			boolean defaultShow, boolean fuzzy, HashMap<String, String> widgetValue, boolean advanceConditionShow,
			boolean searchIsShow) {
		this.colNameEN = colNameEN;
		this.colNameCN = colNameCN;
		this.type = type;
		this.widget = widget;
		this.defaultShow = defaultShow;
		this.fuzzy = fuzzy;
		this.widgetValue = widgetValue;
		this.advanceConditionShow = advanceConditionShow;
		this.searchIsShow = searchIsShow;
	}

	public String getColNameEN() {
		return colNameEN;
	}

	public void setColNameEN(String colNameEN) {
		this.colNameEN = colNameEN;
	}

	public String getColNameCN() {
		return colNameCN;
	}

	public void setColNameCN(String colNameCN) {
		this.colNameCN = colNameCN;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public boolean isDefaultShow() {
		return defaultShow;
	}

	public void setDefaultShow(boolean defaultShow) {
		this.defaultShow = defaultShow;
	}

	public HashMap<String, String> getWidgetValue() {
		return widgetValue;
	}

	public void setWidgetValue(HashMap<String, String> widgetValue) {
		this.widgetValue = widgetValue;
	}

	public String getWidget() {
		return widget;
	}

	public void setWidget(String widget) {
		this.widget = widget;
	}

	public boolean isFuzzy() {
		return fuzzy;
	}

	public void setFuzzy(boolean fuzzy) {
		this.fuzzy = fuzzy;
	}

	public boolean isAdvanceConditionShow() {
		return advanceConditionShow;
	}

	public void setAdvanceConditionShow(boolean advanceConditionShow) {
		this.advanceConditionShow = advanceConditionShow;
	}

	public boolean isSearchIsShow() {
		return searchIsShow;
	}

	public void setSearchIsShow(boolean searchIsShow) {
		this.searchIsShow = searchIsShow;
	}

	public static List<OptionalColumn> getOptionalColumns() {

		List<OptionalColumn> OptionalColumns = new ArrayList<OptionalColumn>();

		ResourceBatchLogFieldsEnum[] values = ResourceBatchLogFieldsEnum.values();

		for (ResourceBatchLogFieldsEnum value : values) {

			OptionalColumn optionalColumn = new OptionalColumn(value.getColNameEN(), value.getColNameCN(),
					value.getType(), value.isDefaultShow(), value.getWidget(), value.isFuzzy(), value.getWidgetValue(),
					value.isSearchIsShow());
			OptionalColumns.add(optionalColumn);

		}
		return OptionalColumns;

	}

	public static List<OptionalColumn> getAdvancedConditionColumns() {

		List<OptionalColumn> OptionalColumns = new ArrayList<OptionalColumn>();

		ResourceBatchLogFieldsEnum[] values = ResourceBatchLogFieldsEnum.values();

		for (ResourceBatchLogFieldsEnum value : values) {

			if (value.isAdvanceConditionShow()) {

				OptionalColumn optionalColumn = new OptionalColumn(value.getColNameEN(), value.getColNameCN(),
						value.getType(), value.isDefaultShow(), value.getWidget(), value.isFuzzy(),
						value.getWidgetValue(), value.isSearchIsShow());
				OptionalColumns.add(optionalColumn);
			}

		}
		return OptionalColumns;

	}

	public static List<String> getDefaultShowColumnEN() {

		List<String> columns = new ArrayList<String>();

		ResourceBatchLogFieldsEnum[] values = ResourceBatchLogFieldsEnum.values();

		for (ResourceBatchLogFieldsEnum value : values) {

			if (value.isDefaultShow()) {

				columns.add(value.getColNameEN());
			}

		}
		columns.add("managerId");
		return columns;
	}

}
